from django.db import models


# Create your models here.
class User(models.Model):
    """用户模型类"""
    STATUS_CHOICE = {
        (False, '正常'),
        (True, '黑名单'),
    }
    username = models.CharField(max_length=20, verbose_name='用户名称')
    email = models.CharField(max_length=20, verbose_name='邮箱')
    password = models.CharField(max_length=500, verbose_name='用户密码')
    head_img = models.ImageField(upload_to='user', verbose_name='头像')
    phone = models.CharField(max_length=20, verbose_name='电话')
    user_token = models.CharField(max_length=500, verbose_name='用户token', default='')
    Blacklist = models.BooleanField(default=False, choices=STATUS_CHOICE, verbose_name='黑名单')
    register_time = models.DateTimeField(auto_now_add=True, verbose_name="注册时间")
    last_login_time = models.DateTimeField(auto_now=True, verbose_name='最后登陆时间')

    class Meta:
        db_table = "sf_User"
        verbose_name = "用户表"
        verbose_name_plural = verbose_name
